
package io.gitee.hefren.hhcache.command;

import io.gitee.hefren.hhcache.core.Command;
import io.gitee.hefren.hhcache.core.CommandEnum;
import io.gitee.hefren.hhcache.core.HhCache;
import io.gitee.hefren.hhcache.core.Reply;

/**
 * @Date 2024/7/9
 * @Author lifei
 */
public class HdelCommand implements Command {
    @Override
    public String name() {
        return CommandEnum.HDEL.name();
    }

    @Override
    public Reply<?> exec(HhCache cache, String[] args) {
        String key = getKey(args);
        String[] fields = getParamsNoKey(args);
        int num = cache.hdel(key, fields);
        return Reply.integerReply(num);
    }
}
